import { createRouter, createWebHistory } from 'vue-router'
import Detail from '../views/detail/Detail.vue'
import Friends from '../views/friends/Friends.vue'
import Home from '../views/home/Home.vue'
import Login from '../views/login/Login.vue'
import Messages from '../views/messages/Messages.vue'
import MyPage from '../views/my/MyPage.vue'
import Publish from '../views/publish/publish.vue'
import Register from '../views/register/Register.vue'
import ResetPassword from '../views/reset_password/ResetPassword.vue'
import UserPage from '../views/user/UserPage.vue'

const routes = [
  {
    path: '/home',  
    name: 'Home',
    component: Home
  },
  {
    path: '/my',
    name: 'MyPage',
    component: MyPage
  },
  {
    path: '/login',
    name: 'Login',
    component: Login
  },
  {
    path: '/register',
    name: 'Register',
    component: Register
  },
  {
    path: '/publish',
    name: 'Publish',
    component: Publish
  },
  {
    path: '/friends',
    name: 'Friends',
    component: Friends
  },
  {
    path: '/messages',
    name: 'Messages',
    component: Messages
  },
  {
    path: '/reset_password',
    name: 'ResetPassword',
    component: ResetPassword
  },
  {
    path: '/detail/:id',
    name: 'Detail',
    component: Detail,
    props: true
  },
  {
    path: '/display/:category?',
    name: 'Display',
    component: () => import('../views/display/Display.vue')
  },
  {
    path: '/user/:userId',
    name: 'UserPage',
    component: UserPage
  },
  {
    path: '/',
    redirect: '/home'
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router